package Task6_5;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/5/4 9:10
 * @description:
 */
public class CopyFile2 {

  public static void main(String[] args) {
    BufferedReader bis=null;
    BufferedWriter bos=null;
    try {
      bis=new BufferedReader(new FileReader("b.txt"));
      bos=new BufferedWriter(new FileWriter("c:\\a.txt"));

      String line=null;
      while ((line=bis.readLine())!=null){
        bos.write(line);
        bos.newLine();
      }
    } catch (FileNotFoundException e) {
      System.out.println(e.getMessage());

    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      if(bis!=null){
        try{
          bis.close();
        }catch (IOException e){
          e.printStackTrace();
        }
      }
      if(bos!=null){
        try {
          bos.close();
        }catch (IOException e){
          e.printStackTrace();
        }
      }
    }

  }

}
